package com.cman777.springc.sample.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cman777.springc.common.bean.enums.StateEnum;
import com.cman777.springc.common.bean.enums.YesNoCodeEnum;
import com.cman777.springc.sample.bean.po.Idempotence;
import com.cman777.springc.sample.bean.po.RatelimitRule;
import com.cman777.springc.sample.mapper.RatelimitRuleMapper;
import com.cman777.springc.sample.service.RatelimitRuleService;
import com.cman777.springc.mybatis.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author czc
 * @since 2020-10-26
 */
@Service
public class RatelimitRuleServiceImpl extends BaseServiceImpl<RatelimitRule, RatelimitRuleMapper> implements RatelimitRuleService {

    @Override
    public List<RatelimitRule> selectEnabledRule() {
        QueryWrapper<RatelimitRule> ratelimitRuleQueryWrapper = new QueryWrapper<>();
        ratelimitRuleQueryWrapper.eq("enabled", YesNoCodeEnum.YES);
        return this.list(ratelimitRuleQueryWrapper);
    }
}
